<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">

	
	<h:form>
		<rich:extendedDataTable id="tabellaOrdini" value="#{ordineController.ordiniSulDb}" var="ordine"
								selection="#{genericListener.selection}" selectionMode="#{genericListener.selectionMode}"
								>
			<a4j:ajax event="selectionchange" listener="#{genericListener.selectionListener}" />					
			
			<rich:column>
				<f:facet name="header">Codice Ordine</f:facet>
				<h:outputText value="#{ordine.codiceOrdine}" />
			</rich:column>
			
			<rich:column>
				<f:facet name="header">Data Accettazione</f:facet>
				<h:outputText value="#{ordine.dataAccettazione}" />
			</rich:column>
			
			<rich:column>
				<f:facet name="header">Data Consegna</f:facet>
				<h:outputText value="#{ordine.dataConsegna}" />
			</rich:column>
			
			<rich:column>
				<f:facet name="header">Stato</f:facet>
				<h:outputText value="#{ordine.stato}" />
			</rich:column>
			
			<rich:column>
				<f:facet name="header">Importo Totale</f:facet>
				<h:outputText value="#{ordine.importoTotale}" />
			</rich:column>
		
			<rich:column>
				<f:facet name="header">Tipo Pagamento</f:facet>
				<h:outputText value="#{ordine.tipoPagamento}" />
			</rich:column>
			
			<f:facet name="footer">
				<a4j:commandButton 	value="Modifica" action ="#{ordineController.modifica(genericListener.ordineSelezionato)}"  
									oncomplete="#{rich:component('popupModificaOrdine')}.show()" render="popupModificaOrdine"
									/>
			
			</f:facet>
	
	
		
	
	
		</rich:extendedDataTable>
		</h:form>
		
	

<!-- Pop che permette di editare ed eventualmente Modificare l'ordine selezionato -->
		<rich:popupPanel id="popupModificaOrdine" width="850" height="600">
			<f:facet name="header">Crea Ordine</f:facet>
			<f:facet name="controls">
				<h:outputLink value="#"
					style="font-size:large; color:black; textdecoration:none;"
					onclick="#{rich:component('popupModificaOrdine')}.hide();return false;">
					X
				</h:outputLink>
			</f:facet>
			<ui:include src="/popup/popupCreaOrdine.xhtml" />
		</rich:popupPanel>



</ui:composition>
